package com.wwtech.epp.ui.activity.work;

import android.os.Bundle;
import android.support.v4.widget.NestedScrollView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.wwtech.epp.R;
import com.wwtech.epp.application.AppConfig;
import com.wwtech.epp.base.BaseActivity;
import com.wwtech.epp.ui.activity.work.component.DaggerLargeTextComponent;
import com.wwtech.epp.ui.activity.work.contract.LargeTextContract;
import com.wwtech.epp.ui.activity.work.module.LargeTextModule;
import com.wwtech.epp.ui.activity.work.presenter.LargeTextPresenter;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: $description
 * @date 2017/10/23 22:48:58
 */

public class LargeTextActivity extends BaseActivity implements LargeTextContract.View {

    @Inject
    LargeTextPresenter mPresenter;
    @BindView(R.id.content)
    TextView content;
    @BindView(R.id.scrollView)
    NestedScrollView scrollView;
    @BindView(R.id.rootView)
    LinearLayout rootView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        setContentView(R.layout.activity_large_text);
        ButterKnife.bind(this);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setVisibility(View.GONE);
    }

    @Override
    protected void initData() {
        content.setText(getIntent().getStringExtra("content"));
    }

    @Override
    public void onBackPressed() {
        finish();
//        overridePendingTransition(0, R.anim.activity_translate_out_to_center);
        overridePendingTransition(0, 0);
    }

    @Override
    protected void setupActivityComponent() {
        DaggerLargeTextComponent
                .builder()
                .appComponent(((AppConfig) getApplication()).getApplicationComponent())
                .largeTextModule(new LargeTextModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void setPresenter(LargeTextContract.LargeTextContractPresenter presenter) {
        mPresenter = (LargeTextPresenter) presenter;
    }

    @Override
    public void showProgressDialog() {
        progressDialog.show();
    }

    @Override
    public void closeProgressDialog() {
        progressDialog.hide();
    }

    @OnClick({R.id.rootView, R.id.content, R.id.scrollView})
    public void onViewClicked() {
        onBackPressed();
    }
}